package com.wrenchmonkeys;

import java.util.logging.Level;
import java.util.logging.Logger;

import javacream.util.logger.BasicFormatter;

import com.jmebananas.game.state.AdvancedGameState;
import com.jmex.game.StandardGame;
import com.jmex.game.state.GameStateManager;

/**
 * WrenchMonkeys
 * 
 * @author Glenn Powell
 *
 */
public class WrenchMonkeys {

	public static void main(String[] args) {
		new WrenchMonkeys();
	}
	
	
	public static final String GAME_NAME = "Wrench Monkeys";
	
	
	private AdvancedGameState gameState;

	//com.powell.math.Curve<Float, Float> curve = new com.powell.math.Curve<Float, Float>();

	
	public WrenchMonkeys() {
		/*
		curve.addPoint(10f, 10f);
		curve.addPoint(20f, 15f);
		curve.addPoint(100f, 205f);
		curve.addPoint(120f, 35f);
		curve.setInterpolator(new com.powell.math.SplineInterpolator());
		
		javax.swing.JFrame frame = new javax.swing.JFrame("test");
		
		frame.setContentPane(new javax.swing.JPanel() {
			public void paint(java.awt.Graphics g) {
				super.paint(g);
				WrenchMonkeys.this.paint(g, getWidth(), getHeight());
			}
		});
		
		frame.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
		frame.setSize(600, 500);
		frame.setVisible(true);
		*/
		BasicFormatter formatter = new BasicFormatter();
		Logger.getAnonymousLogger().getParent().getHandlers()[0].setFormatter(formatter);
		Logger.getLogger("com.jme").setLevel(Level.WARNING);
		Logger.getLogger("com.jmex").setLevel(Level.WARNING);
			
		StandardGame game = new StandardGame(GAME_NAME);
		game.start();

		//LoadingGameState loadingState = new LoadingGameState();
		//GameStateManager.getInstance().attachChild(loadingState);
		//loadingState.setActive(true);

		gameState = new MainGameState(GAME_NAME, game);
		GameStateManager.getInstance().attachChild(gameState);
		gameState.setActive(true);
	}
	/*
	public void paint(java.awt.Graphics g, int w, int h) {
		g.setColor(java.awt.Color.white);
		g.fillRect(0, 0, w, h);
		g.setColor(java.awt.Color.blue);
		for (java.util.Iterator<com.powell.util.Pair<Float, Float>> itr = curve.getPoints(); itr.hasNext();) {
			com.powell.util.Pair<Float, Float> p = itr.next();
			g.drawRect((int)p.getFirst().floatValue() - 2, (int)p.getSecond().floatValue() - 2, 5, 5);
		}
		g.setColor(java.awt.Color.black);
		for (int x = 0; x < w; ++x) {
			try {
				int y = curve.interpolate((float)x).intValue();
				g.drawLine(x, y, x, y);
			} catch (InterpolationException e) {
				e.printStackTrace();
			}
		}
	}
	*/

}
